package com.iflytek.day11._02_Extend.p02;

public class Demo {
  public static void main(String[] args) {
    Zi z = new Zi();
    System.out.println(z.num1);
    // System.out.println(z.num2); // 私有的子类无法使用
    // 通过getter/setter方法访问父类的private成员变量
    System.out.println(z.getNum2());

    z.show1();
    // z.show2(); // 私有的子类无法使用
  }
}

class Fu {
  public int num1 = 10;
  private int num2 = 20;

  public void show1() {
    System.out.println("show1");
  }

  private void show2() {
    System.out.println("show2");
  }

  public void show3() {
    show2();
    System.out.println("这是父亲的show3方法");
  }

  public int getNum2() {
    return num2;
  }

  public void setNum2(int num2) {
    this.num2 = num2;
  }
}

class Zi extends Fu {
}
